import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class NavigatorPushNamedPage extends StatelessWidget{
  static final String routeName = '/NavigatorPushNamedPage';
  final String info;

  NavigatorPushNamedPage(this.info);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('传参示例'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          children: <Widget>[
            Text(
              '${this.info}',
              style: TextStyle(fontSize: 20,color: Colors.black),
            ),
            FlatButton(
              onPressed: ()=>{
                _navigatorPopPage2(context)
              },
              child: Text('点击返回',style: TextStyle(fontSize: 20,color: Colors.blue),),
            )
          ],
        )

      ),
    );
  }

}

//可以添加可选参数 result 作为页面返回时携带的参数
_navigatorPopPage2(BuildContext context) {
  Navigator.of(context).pop<String>('上个页面带回的信息：112111');
}
